import '../../../lib_baseview/provider.dart';
import 'chat_room_leaf_interface.dart';

@deprecated
mixin RoomMsgNotifierMixin on JRChangeNotifier {
  /// 以下为框架代码，勿动
  List<ChatRoomChangeNotifier> models = [];

  @deprecated
  register(ChatRoomChangeNotifier model) {
    if (models.contains(model)) {
      return;
    }
    models.add(model);
  }

  @deprecated
  unregister(ChatRoomChangeNotifier model) {
    if (!models.contains(model)) {
      return;
    }
    models.remove(model);
  }

  @deprecated
  sendMessage(int messageId, {dynamic data}) {
    models.forEach((model) {
      try {
        model.observeMessage(messageId, data);
      } catch (e) {
        print("sendMessage error:${e}");
      }
    });
  }
}
